package com.cmseducation.controller;

import com.cmseducation.entity.EduTeacher;
import com.cmseducation.service.IEduTeacherService;
import com.cmseducation.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * <p>
 * 讲师 前端控制器
 * </p>
 *
 * @author mr.tang
 * @since 2022-04-18
 */
@CrossOrigin
@RestController
@RequestMapping("/cmsteacher")
public class EduTeacherController {

    @Autowired
    IEduTeacherService iEduTeacherService;

    /*
    * 名师查询
    * */
    @Cacheable(key = "'eduTeachers'",value = "eduTeachers")
    @GetMapping("getfamousteacher")
    public R queryBetterTeacher(){
        List<EduTeacher> eduTeachers = iEduTeacherService.queryBetterTeacher();
        return R.ok().data("famousTeacher",eduTeachers);
    }


}
